<%@ page language="java" %>
<%@ page import="com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.users.Functionality" %>
<%@ page import="com.scalar.chiptrack.users.User" %>
<%@ page import="com.scalar.chiptrack.commons.SessionKeys" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<html:html locale="true">
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<% User _user1 = (User) session.getAttribute(SessionKeys.USER_KEY);%>
<HEAD><TITLE>Scalar Soft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</SCRIPT>

<SCRIPT language="JavaScript">
var prevPrice = 0;
function fieldLength(value, disMessage, len)
{
    if( value.length > len )
    {
        errMsg = disMessage +" length cannot be greater than " + len + " charecters";
        return false;
    }
    else
    {
        return true;
    }
}

function resetValues()
{
        if (typeof document.shippingAdviseForm.selectLineitem != "undefined" )
        {
            if (typeof document.shippingAdviseForm.selectLineitem.length == "undefined" )
            {
                    var shippedPartNoObj = document.shippingAdviseForm['lineitems[0].shipped_Part_Number'];
                    for(var i = 0 ; i < shippedPartNoObj.length ; i++ )
                    {
                        shippedPartNoObj.options[i].selected = false;
                    }
            }
            else
            {
                var fg = 0;
                var lineItemCheck = "" +  document.shippingAdviseForm.selectLineitem.length;
                for ( var k = 0; k < parseInt( lineItemCheck ) ; k++ )
                {
                    var shippedPartNoObj = document.shippingAdviseForm[ 'lineitems[' + k +'].shipped_Part_Number'];
                    for(var i = 0 ; i < shippedPartNoObj.length ; i++ )
                    {
                        shippedPartNoObj.options[i].selected = false;
                    }
                }
           }
       }
}


function checkLength(element, size)
{
    if(	element.value.length >= size )
	{
		event.returnValue = false;
	}
}

function addTrackingNumberField( fontId )
{
    var htmltext1 = '<table style=NArialL cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td width="20%"><font class="NArialL"><font color="green">Way Bill:</font></font></td><td width="80%" align="left"><input type="text" name="tracking" class="txfield" size="20" maxlength="50" /></td></tr></table>';
    var pa1 = document.getElementById (fontId);
    pa1.insertAdjacentHTML ('BeforeEnd',htmltext1);
}


function chjIndexAndaddOptionToSelect(indexElement)
{
    var optionValue1 = document.shippingAdviseForm[ 'lineitems[' + indexElement +'].part_Number'].value;
    var partNumberObj = document.shippingAdviseForm[ 'lineitems[' + indexElement +'].shipped_Part_Number'];
    if( partNumberObj.options.length == 0 )
    {
        addOption(partNumberObj, optionValue1, optionValue1, partNumberObj.options.length);
    }
}

function addOptionToSelect(aName, aValue, indexElement)
{
    var partNumberStr = aName + "";
    var partNumberObj = document.shippingAdviseForm[ 'lineitems[' + indexElement +'].qtyPulledSubstitutablePartNo'];
    var alreadyExistFlag = false;
    if( typeof partNumberObj != 'undefined' )
    {
        for( var i=0 ; i < partNumberObj.options.length ; i++ )
        {
            //alert ( "[Element=" + indexElement + "][Index=" + i + "][Fetched = " + aValue + "][" + partNumberObj.options[i].value )
            if( aValue ==  partNumberObj.options[i].value)
            {
                alreadyExistFlag = true;
                break;
            }
        }
    }
    if( alreadyExistFlag == false )
    {
        addOption(partNumberObj, partNumberStr, partNumberStr, partNumberObj.options.length);
    }
}

function addOption(aSelect, aName, aValue, anIndex)
{
   var aOption = new Option(aName, aValue)
   aSelect.options[anIndex] = aOption;
   //aSelect.blur();
}

function deleteAllOptions(indexElement)
{

    var partNumberObj = document.shippingAdviseForm[ 'lineitems[' + indexElement +'].qtyPulledSubstitutablePartNo'];

    if( typeof partNumberObj !='undefined' )
    {
        for( var j = partNumberObj.options.length ; j >= 0 ; j-- )
        {
             partNumberObj.options[j] = null;
        }
    }
}


function selectInventory( x )
{
    if ( document.shippingAdviseForm.selectLineitem.length == null )
    {
        if ( document.shippingAdviseForm.selectLineitem.checked )
        {
            document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].disabled = false;
        }
        else
        {
			document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].disabled = true;
            document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].value	= 0;
        }
    }
    else
    {
        if ( document.shippingAdviseForm.selectLineitem[x].checked )
        {
            document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].disabled = false;
        }
        else
        {
            document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].disabled = true;
            document.shippingAdviseForm[ 'lineitems[' + x +'].qtyPulled'].value	= 0;
        }
    }
    checkMessage();
}

function checkMessage()
{
    var error1	= document.getElementById("errors1");
    var lineItemCheck = "" +  document.shippingAdviseForm.selectLineitem.length;

    if( lineItemCheck == "undefined" )
    {
        if ( document.shippingAdviseForm.selectLineitem.checked == true )
        {
            errorMsg1 = "";
            error1.innerHTML	= errorMsg1 ;
            document.shippingAdviseForm.txtErrMsgDetail.value="";
        }
    }
    else
    {
        for ( var k = 0; k < parseInt( lineItemCheck ) ; k++ )
        {
            if ( document.shippingAdviseForm.selectLineitem[k].checked == true )
            {
                document.shippingAdviseForm.txtErrMsgDetail.value="";
                errorMsg1 = "";
                error1.innerHTML	= errorMsg1 ;

            }
        }
    }
}
function openInventoryNew ( i, viewInventory, modifyInventory )
{
	var msg;
	var finalInventoryURL;
    var substitutePSIds     = "";
    var substituteSelected  = false;
    var partNumber		    = document.shippingAdviseForm[ 'lineitems[' + i +'].part_Number'].value;
    var parentPartNumber		= document.shippingAdviseForm[ 'lineitems[' + i +'].parentPartNumber'].value;

	if( document.shippingAdviseForm.status.value != "SHIPPED" )
	{
		if( typeof document.shippingAdviseForm.selectLineitem.length == "undefined" )
		{
			msg = document.shippingAdviseForm.selectLineitem.checked;
		}
		else
		{
			msg = document.shippingAdviseForm.selectLineitem[i].checked;
		}

		if ( msg == false )
		{
			document.shippingAdviseForm.txtErrMsgDetail.value="Please select a check box for inventory";
			return;
		}
	}
    var shippedPartNoObj = document.shippingAdviseForm['lineitems[' + i + '].shipped_Part_Number'];
    if( parentPartNumber != "" )
    {
        substitutePSIds = parentPartNumber + ",";
    }
    for(var j = 0 ; j < shippedPartNoObj.length ; j++ )
    {
        if( shippedPartNoObj.options[j].selected == true )
        {
            substitutePSIds = substitutePSIds +  shippedPartNoObj.options[j].value + ","
            substituteSelected = true;
        }
    }
    if( substitutePSIds.length > 0 )
    {
        substitutePSIds = substitutePSIds.substring(0,substitutePSIds.length-1);
    }
    if( substituteSelected == false )
    {
        //substitutePSIds = document.shippingAdviseForm[ 'lineitems[' + i +'].shippingAdviseForm'].value
        //document.shippingAdviseForm.txtErrMsgDetail.value="Please select a substitutable part numbers";
        //return;
    }

	var orgQtyShipped	= document.shippingAdviseForm[ 'lineitems[' + i +'].orginalQtyPulled'].value;
	var qtyToShip		= document.shippingAdviseForm[ 'lineitems[' + i +'].qtyToShip'].value;
	var qtyPulled		= document.shippingAdviseForm[ 'lineitems[' + i +'].qtyPulled'].value;
	//var partNumber		= document.shippingAdviseForm[ 'lineitems[' + i +'].part_Number'].value;
	var lineItemId		= document.shippingAdviseForm[ 'lineitems[' + i +'].lineItemId'].value;
	var requestedQty    = document.shippingAdviseForm[ 'lineitems[' + i +'].cool_Qty'].value;
	var customerShippingLineItemId	= document.shippingAdviseForm[ 'lineitems[' + i +'].customerShippingLineItemId'].value;
    var shippingFromAddressId		= document.shippingAdviseForm.shippingFromLocationId.value;

	var dropShip					= document.shippingAdviseForm.dropShippment.value;
	var calQytToBeShipped = 0;
	var hiddenQtyPulled;


    hiddenQtyPulled = document.shippingAdviseForm[ 'lineitems[' + i +'].hiddenQtyPulled'].value;
	if( dropShip == 'false' )
	{
		if ( orgQtyShipped > 0 )
		{
			calQytToBeShipped = parseInt( orgQtyShipped ) - parseInt( qtyPulled ) + parseInt( qtyToShip );
		}
		else
		{
			calQytToBeShipped = parseInt( qtyToShip );
		}
	}
	else
	{
        calQytToBeShipped = parseInt( hiddenQtyPulled );
	}

    if( document.shippingAdviseForm.status.value != 'SHIPPED' )
	{
        if( modifyInventory == 'true' )
        {
            finalInventoryURL = '<%=chipTracContext%>/finalInventory.do?partNumber=' + escape(partNumber) + '&lineItemId=' + lineItemId + '&csLineItemId='+ customerShippingLineItemId +'&quantityToBeShipped=' + calQytToBeShipped + '&requestedQty=' + requestedQty + '&issedPackingSlip=true&openOrIssued=view&shippingFromAddressId='+shippingFromAddressId+'&index='+i+'&dropShip='+ dropShip+'&viewonly=false&parentPartNo=' + escape(parentPartNumber) + '&isReqFromTrackingNoPage=true&substitutePSIds=' + escape(substitutePSIds) + '&modifyInventory=' + modifyInventory;
        }
        else
        {
		    finalInventoryURL = '<%=chipTracContext%>/finalInventory.do?partNumber=' + escape(partNumber) + '&lineItemId=' + lineItemId + '&csLineItemId='+ customerShippingLineItemId +'&quantityToBeShipped=' + calQytToBeShipped + '&requestedQty=' + requestedQty + '&issedPackingSlip=true&openOrIssued=OPEN&shippingFromAddressId='+shippingFromAddressId+'&index='+i+'&dropShip='+ dropShip+'&viewonly=true&parentPartNo=' + escape(parentPartNumber) + '&isReqFromTrackingNoPage=true&substitutePSIds=' + escape(substitutePSIds) + '&modifyInventory=' + modifyInventory;
        }
	}
	else
	{
		finalInventoryURL = '<%=chipTracContext%>/finalInventory.do?partNumber=' + escape(partNumber) + '&lineItemId=' + lineItemId + '&csLineItemId='+ customerShippingLineItemId +'&quantityToBeShipped=' + calQytToBeShipped + '&requestedQty=' + requestedQty + '&issedPackingSlip=false&openOrIssued=OPEN&shippingFromAddressId='+shippingFromAddressId+'&index='+i+'&dropShip='+ dropShip+'&viewonly=true&parentPartNo=' + escape(parentPartNumber) + '&isReqFromTrackingNoPage=true&substitutePSIds=' + escape(substitutePSIds) + '&modifyInventory=' + modifyInventory;
	}

    var LeftPos=(screen.width)?(screen.width-1200)/2:100;
    var TopPos=(screen.height)?(screen.height-600)/2:100;
	newWindow = window.open (finalInventoryURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=900,height=450,resizable=yes,Left= '+LeftPos+',top='+TopPos);
    newWindow.focus();
}


function logOffAction()
{
     document.shippingAdviseForm.action="externalUserLogoff.do"
     document.shippingAdviseForm.submit();
     //window.close();
}

var errObj=null;
var trackingNoLen=null;
function submitPage()
{
    var trackingNo = document.shippingAdviseForm["tracking"];
    var trackingId = document.shippingAdviseForm["trackingId"];
    var etd = document.shippingAdviseForm["etd"];
    var etdVal = document.shippingAdviseForm["etd"].value.trim();
    var eta = document.shippingAdviseForm["eta"];
    var etaVal = document.shippingAdviseForm["eta"].value.trim();
    var cartons = document.shippingAdviseForm["cartonCount"].value.trim();
    var palettes = document.shippingAdviseForm["paletteCount"].value.trim();
    var weight   = document.shippingAdviseForm.weight.value.trim();
    var cartoncount   = document.shippingAdviseForm.cartonCount.value.trim();
    var actualShipDate = document.shippingAdviseForm["shipDate"].value.trim();

    var errorText = "";
    
    var form  = document.shippingAdviseForm;
    var count =	form.count.value;
    errObj = document.getElementById("ErrMsg");
    jsErrObj = document.getElementById("JSErrMsg");

    trackingNoLen = 0;

    if ( cartoncount != "" )
	{
        document.shippingAdviseForm["cartonCount"].value = document.shippingAdviseForm["cartonCount"].value.trim();
		if ( checkInteger( cartoncount, ' Number of Cartons', 'Y' ) == false )
		{
            jsErrObj.innerHTML = errMsg;
            window.scrollBy(0,0);
            return false;
		}
	}

    if ( weight != "" )
	{
		if ( (checkFloat( weight, 'Weight', 'Y' ) == false) || (fieldLength(weight,"Weight",8) == false) )
		{
            jsErrObj.innerHTML = errMsg;
            window.scrollBy(0,0);
            return false;
		}
       if(check_char_position4(weight) || (is_Sp_Characters_frieght(weight) == false)  )
       {
            jsErrObj.innerHTML = "<li> Please enter a valid Weight";
            window.scrollBy(0,0);
            return false;
       }
       if( weight.length >= 6 )
        {
            var qtyValue = weight;
            var index = qtyValue.indexOf(".");
            if( index == -1 || index > 5 )
            {
                jsErrObj.innerHTML = "<li> Please enter a valid Weight (weight should be in XXXXX.XX format)";
                window.scrollBy(0,0);
                return false;
            }

        }
	}


    if( chkDate( etdVal, "ETD Date", "N" ) == false )
	{
        jsErrObj.innerHTML = errMsg;
        window.scrollBy(0,0);
		return false;
	}

    if( chkDate( etaVal, "ETA Date", "N" ) == false )
	{
        jsErrObj.innerHTML = errMsg;
        window.scrollBy(0,0);
		return false;
	}

    if( chkDate( actualShipDate, "Ship Date", "Y" ) == false )
	{
        jsErrObj.innerHTML = errMsg;
        window.scrollBy(0,0);
		return false;
	}
    else if ( isBeforeToday( actualShipDate, "Ship Date" ) ) // added by Ganesh on 21 th aprl 2007 as schedule date can not be before today date
    {
        jsErrObj.innerHTML = errMsg;
        window.scrollBy(0,0);
		return false;
    }

    if ( checkInteger( cartons, ' No.of Cartons', 'N' ) == false )
	{
	    jsErrObj.innerHTML = errMsg  ;
        window.scrollBy(0,0);
		return false;
	}
    if ( checkInteger( palettes, ' No.of Palettes', 'N' ) == false )
	{
	    jsErrObj.innerHTML = errMsg  ;
        window.scrollBy(0,0);
		return false;
	}
    errorText = checkTrackingNo("N");
	if ( errorText != "" )
	{
        jsErrObj.innerHTML = errorText  ;
        window.scrollBy(0,0);
		return false;
	}

    for( i = 0; i < count; i++ )
    {
		form[ 'lineitems[' + i +'].qtyPulled'].disabled = false;
	}
	return true;
}

//Added Krishna Prasad on 03 June 2004

function chkTrackingNoForEmpty(lotId)
{
    var trackNo = document.shippingAdviseForm["tracking"];

    if( trackingNoLen == 1 )
    {
        if(lotId.value == "1")
        {
            if(trackNo.value == "")
            {
                 errObj.innerHTML = "Way Bill should not be empty";
                 trackNo.focus();
                 return false;
            }
        }
    }
    else if( trackingNoLen > 1 )
    {
        for(var z = 0; z < trackNo.length; z++)
        {
            //alert( (z+1)  + " FrieghtNo = " + trackNo[z].value + ":Lotid = " + lotId.value )
            if(lotId.value == (z + 1) + "")
            {
                if(trackNo[z].value == "")
                {
                     errObj.innerHTML = "Way Bill should not be empty";
                     trackNo[z].focus();
                     return false;
                }
            }
        }
    }
    return true;
}

function trackNoValidation( id , noLen )
{
    var trackNo1 = document.shippingAdviseForm["tracking"];
    if( id.value.length > 0 )
    {
        if( noLen == 0 )
        {
            errObj.innerHTML = "Atleast one tracking number should be present, please click above link to add";
            return false;
        }
        else
        {
            if( isNaN ( id.value ) )
            {
                errObj.innerHTML = "Enter numbers only ";
				id.focus();
                return false;
            }
            if( ( id.value <= 0 ) || ( id.value > noLen ) )
            {
                errObj.innerHTML = "Please enter number within above Tracking Id's";
				id.focus();
                return false;
            }
        }
    }
    return true;
}


function updateinfo()
{
    if ( submitPage() )
    {
        document.shippingAdviseForm.submit();
    }
}

function removeTrackingNumber( cslitId, lotId, lotNumber )
{
    document.shippingAdviseForm.action = '<%=chipTracContext%>/shippingAdvise.do?action=removeTracking&cslitId=' + cslitId + '&lotId=' + lotId + '&lotNumber=' + lotNumber + '&ps=' + document.shippingAdviseForm.customerShippingId.value;
    document.shippingAdviseForm.submit();
}

function sendShipAlert( customerShippingId, salesOrderId, target )
{
    newWindow = window.open ('<%=chipTracContext%>/sendMail.do?customerShippingId='+customerShippingId +'&salesOrderId='+salesOrderId+ '&vendorMailAttachmentType=' + target,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}

function printablePackingSlip(customerShippingId) {
    var packingSlipViewURL = '<%=chipTracContext%>/packingSlip.do?action=printView&showMainMenu=false&customerShippingId=' + customerShippingId + '&isReqFromTrackingNoPage=true&recipientType=vendor'
    newWindow = window.open (packingSlipViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function generatePDF(customerShippingId,fileType)
{
    var generatePDFURL = '<%=chipTracContext%>/shippingAdvise.do?action=generatePDF&customerShippingId=' + customerShippingId + '&fileType=' + fileType + "&ps="+document.shippingAdviseForm.ps.value+"&cstKey="+document.shippingAdviseForm.cstKey.value;
    newWindow = window.open (generatePDFURL,'generatePDFPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function addTrackingNumberField_Old( fontId )
{
    document.shippingAdviseForm.trackingCount.value = parseInt( document.shippingAdviseForm.trackingCount.value ) + 1
    var htmltext1 = '<table class="NArialL" cellspacing=0 cellpadding=0 width="100%" border=0><tr height=10><td width="30%" align=center bgcolor="#DEE1E2" NOWRAP>' + document.shippingAdviseForm.trackingCount.value + '</td><td width="60%" align=left bgcolor="#DEE1E2" NOWRAP><input type=text name="tracking" size=25 maxlength=25 class="txfield"></td><td width="10%">&nbsp;</td></tr></table>';
    var pa1 = document.getElementById( fontId );
    pa1.insertAdjacentHTML( 'BeforeEnd', htmltext1 );
}
function checkNull( values )
{
	 var len = values.length;
	 var str = "";
 	 for ( var k = 0; k < len; k++ )
	 {
		var ch = values.charCodeAt(k);
	 	if ( ch == 13 || ch == 10 || ch== 32 )   //check for enter key and spaces
			continue;
		else
			str = str + values.charAt( k );
	}

	if ( str == "" )
		return false;
	else
		return true;
}
function checkTrackingNo(isCompulsory)
{
	var trackLen =  "" + document.shippingAdviseForm.tracking.length;
	var flag     = 0;
    var vFlag    = 0;
    var errorMsg = "";

	if ( typeof document.shippingAdviseForm.tracking.length == "undefined"  )
	{
        document.shippingAdviseForm.tracking.value = document.shippingAdviseForm.tracking.value.trim();
		var trackValue  = document.shippingAdviseForm.tracking.value;
        if( isCompulsory == "Y" )
        {
            if( checkNull( trackValue ) == false  )
            {
                errorMsg = errorMsg + "<li>Please enter value for Way Bill</li>";
                return errorMsg;
            }
        }
        if( alphanumSpecial( trackValue, "Way Bill", "N" ) == false )
		{
			errorMsg = errorMsg + "<li>Way Bill should be valid</li>";
			return errorMsg;
		}
	}
	else
	{
		for( var j = 0; j < parseInt( trackLen ); j++ )
		{
            document.shippingAdviseForm.tracking[j].value = document.shippingAdviseForm.tracking[j].value.trim();
			var trackValue  = document.shippingAdviseForm.tracking[j].value;
            if( isCompulsory == "Y" )
            {
                if ( checkNull( trackValue ) == false )
                {
                    flag = 1;
                    break;
                }
            }
            if( alphanumSpecial( trackValue, "Way Bill", "N" ) == false)
            {
                vFlag = 1;
				break;
            }
		}
		if( flag == 1 )
		{
			errorMsg = errorMsg + "<li>Please enter value for Way Bill</li>";
			return errorMsg;
		}
        if( vFlag == 1 )
		{
			errorMsg = errorMsg + "<li>Way Bill should be valid </li>";
			return errorMsg;
		}
	}
    return errorMsg;
}

function checkNoBoxes()
{
	var boxes    = document.shippingAdviseForm.cartonCount.value.trim();
    document.shippingAdviseForm.cartonCount.value = document.shippingAdviseForm.cartonCount.value.trim();
    var errorMsg = "";
	if ( boxes == "" )
	{
		errorMsg = "<li>Please enter value for No. of Boxes</li> ";
	}
    else
	{
		if ( checkInteger( boxes, 'No. of Cartons', 'Y' ) == false )
		{
			errorMsg = "<li>" + errMsg + "</li>" ;
	 	}
	}
	return errorMsg;
}

function confirmPackingSlip( dropship )
{
    var flag = 1;
    var errorMsg	= "";
    var actualShipDate = document.shippingAdviseForm["shipDate"].value.trim();
    var etd = document.shippingAdviseForm["etd"];
    var etdVal = document.shippingAdviseForm["etd"].value.trim();
    var eta = document.shippingAdviseForm["eta"];
    var etaVal = document.shippingAdviseForm["eta"].value.trim();
    var cartons = document.shippingAdviseForm["cartonCount"].value.trim();
    var palettes = document.shippingAdviseForm["paletteCount"].value.trim();
    var weight   = document.shippingAdviseForm.weight.value.trim();
    var cartoncount   = document.shippingAdviseForm.cartonCount.value.trim();
    var form  = document.shippingAdviseForm;
    var count =	form.count.value;
    var errorText = "";

    errorText = checkTrackingNo("Y");
	if ( errorText != "" )
	{
        errorMsg = errorMsg + errorText;
		flag = 0;
	}
    errorText = checkNoBoxes();
	if ( errorText != "" )
	{
        errorMsg = errorMsg + errorText;
		flag = 0;
	}
    if( chkDate( actualShipDate, "Ship Date", "Y" ) == false )
	{
        errorMsg = errorMsg + errMsg ;
		flag = 0;
	}
    else if ( isBeforeToday( actualShipDate, "Ship Date" ) ) // added by Ganesh on 21 th aprl 2007 as schedule date can not be before today date
    {
        errorMsg = errorMsg + errMsg ;
		flag = 0;
    }

    if ( weight != "" )
	{
		if ( (checkFloat( weight, 'Weight', 'Y' ) == false) || (fieldLength(weight,"Weight",8) == false) )
		{
            errorMsg = errorMsg + "<li>" + errMsg + "</li>" ;
            flag = 0;
		}
       if(check_char_position4(weight) || (is_Sp_Characters_frieght(weight) == false)  )
       {
            errorMsg = errorMsg + "<li> Please enter a valid Weight";
            flag=0;
       }
       if( weight.length >= 6 )
        {
            var qtyValue = weight;
            var index = qtyValue.indexOf(".");
            if( index == -1 || index > 5 )
            {
                errorMsg = errorMsg + "<li> Please enter a valid Weight (weight should be in XXXXX.XX format)";
                flag=0;
            }

        }
	}

    if( chkDate( etdVal, "ETD Date", "N" ) == false )
	{
        errorMsg = errorMsg + errMsg ;
		flag = 0;
	}

    if( chkDate( etaVal, "ETA Date", "N" ) == false )
	{
        errorMsg = errorMsg + errMsg ;
		flag = 0;
	}
    
    if ( checkInteger( palettes, ' No.of Palettes', 'N' ) == false )
	{
	    errorMsg = errorMsg + errMsg ;
        //window.scrollBy(0,0);
		flag = 0;
	}
    if( document.shippingAdviseForm.status.value != "SHIPPED" )
    {
        if (typeof document.shippingAdviseForm.selectLineitem.length == "undefined" )
        {
            if(  document.shippingAdviseForm['lineitems[0].inventoryPulled'].value == '0' )
            {
                errorMsg = errorMsg + '<li>  No inventory pulled for the Lineitem ' + document.shippingAdviseForm[ 'lineitems[0].lineitemNumber'].value
                flag = 0;
            }
        }
        else
        {
            var lineItemCheck = "" +  document.shippingAdviseForm.selectLineitem.length;
            for ( var k = 0; k < parseInt( lineItemCheck ) ; k++ )
            {
                if(  document.shippingAdviseForm[ 'lineitems[' + k +'].inventoryPulled'].value == '0' )
                {
                    errorMsg = errorMsg + '<li>  No inventory pulled for the Lineitem ' + document.shippingAdviseForm[ 'lineitems[' + k +'].lineitemNumber'].value
                    flag = 0;
                }
            }
        }
    }
    if ( flag == 1 )
	{
        for( i = 0; i < count; i++ )
        {
            form[ 'lineitems[' + i +'].qtyPulled'].disabled = false;
        }
		document.shippingAdviseForm.action = '<%=chipTracContext%>/shippingAdvise.do?action=view&showMainMenu=false&confrimPackingSlip=true';
        document.shippingAdviseForm.submit();
	}
    else
	{
		var error	= document.getElementById( "JSErrMsg" );
        error.innerHTML		= errorMsg ;
	}

}

function runAdaptor( locationAddressId )
{
    newWindow = window.open ('<%=chipTracContext%>/runAdaptor.do?action=runAdaptorByVendor&locationAddressId=' + locationAddressId + '&requestFromVendorInterface=true' ,'vendorRunAdaptor','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=800,height=400,resizable=no');
    newWindow.focus();
}

var dateElement = "";
function openCalendar( dateValue )
{
    dateElement = dateValue;
    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.focus();
}
function assignDate( passedValue )
{
    dateElement.value=passedValue;
    window.focus();
}
function showErrorReportPage()
{
    newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
    newWindow.focus();
}
</script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<%@include file="/jsp/includes/extHeader.jsp"  %>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
    <TBODY>
        <TR>
            <TD width='20%' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
                <%@ include file="/jsp/admin/externaluser_menu.jsp" %>
            </TD>
            <TD width='1%' bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
            <TD width='1%' bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
            <TD valign="top" width="100%">
                <table border="0" cellspacing=0 cellpadding=0 width="100%">
                    <tr>
                        <td width="10%" align="right">&nbsp;</td>
                        <td width="45%" class="NArialW" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shipping Details</td>
                        <td width="20%" valign="bottom" align="left" class="NArialS">&nbsp;
                            <html:form name="shippingAdviseForm" type="com.scalar.chiptrack.operations.packingslip.forms.ShippingAdviseForm" action="/shippingAdvise.do?action=updateinfo" scope="request">
                            <logic:equal  name="shippingAdviseForm" property="status" value="ISSUED">
                                <logic:equal  name="shippingAdviseForm" property="dropShippment" value="true">
                                    <chiptrack:restrictedLink href="javascript:confirmPackingSlip( false );" functionality="<%=Functionality.PACKING_SLIP%>" action="<%=User.USER_ACTION_MODIFY%>" onmouseover="window.status='Click to Confirm This Packing Slip';return true" onmouseout="window.status='';return true">
                                    <b>[Confirm This Shipment]</b>
                                    </chiptrack:restrictedLink>
                                </logic:equal>
                            </logic:equal>&nbsp;&nbsp;&nbsp;
                            <font class="NArialL">&nbsp;</font>
                        </td>
                        <td width="25%" valign="bottom" class="NArialL" align="left">&nbsp;</td>
                    </tr>
                    <%
                        if ( _user1 != null && !_user1.isActionAllowed ( Functionality.PACKING_SLIP, User.USER_ACTION_MODIFY  )  )
                        {
                    %>
                        <tr><td colspan='4'><font class="NArialS"><font color="blue"><b><%=Constants.NO_MODIFY_RIGHTS%></b></font><td><tr>
                    <%
                        }
                    %>
                    <tr>
                        <td colspan="4" width="100%" >
                            <html:hidden name="shippingAdviseForm" property="customerShippingId"/>
                            <html:hidden name="shippingAdviseForm" property="customerName"/>
                            <html:hidden name="shippingAdviseForm" property="number"/>
                            <html:hidden name="shippingAdviseForm" property="status"/>
                            <html:hidden name="shippingAdviseForm" property="shippingFromLocationId"/>
                            <html:hidden name="shippingAdviseForm" property="dropShippment"/>

                            <input type="hidden" name="ps" value="<%=session.getAttribute("ps")%>">
                            <input type="hidden" name="cstKey" value="<%=session.getAttribute("cstKey")%>">

                            <input type=hidden name="trackingCount" value=0 >
                                <table border="0" width="100%" cellspacing=5 align=center valign=top class="NArialL">
                                <tr>
                                    <td width="78%" colspan="4">
                                        <chiptrack:info   styleClass="NArialL"/><BR>
                                        <chiptrack:errors styleClass="NArialL"/><BR>
                                        <FONT id="JSErrMsg" styleClass="NArialL" color="red"></FONT><br>
                                        <FONT id="ErrMsg" styleClass="NArialL" color="red"></FONT>
                                    </td>
                                    <td width="22%" valign="top">&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100%" colspan="5" >
                                        <table width="70%" border="0" align="left">
                                            <tr>
                                                <td width="50%" valign="top" align="right">
                                                    <font class='NArialL'>
                                                    [<a href="javascript:generatePDF(<bean:write name="shippingAdviseForm" property="customerShippingId"/>,'packingslip');" onMouseOver="window.status='Printer-Friendly Version';return true" onMouseOut="window.status='';return true">
                                                        Click here to download PDF Version of Packing Slip</a>]<%--&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                    </font>
                                                </td>
                                                <td width="50%"valign="top" align="left">
                                                    <font class='NArialL'>
                                                        [<a href="javascript:generatePDF(<bean:write name="shippingAdviseForm" property="customerShippingId"/>,'commercial');" title='Click here to send the ship alert' onMouseOver="window.status='Click here to send the ship alert';return true" onMouseOut="window.status='';return true">
                                                        Click here to download PDF Version of Commercial Invoice</a>]
                                                    </font>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr><td colspan="5" width="100%">&nbsp;</td></tr>
                                <tr>
                                    <td width="20%" align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;<bean:message key="label.packingSlip.VendorFace.InvoiceNumber"/>:</td>
                                    <td width="15%" align="left">
                                        <html:text name="shippingAdviseForm" property="number" size="20" maxlength="20" styleClass="txfield" disabled="true"/>
                                    </td>
                                    <td width="2%">&nbsp;</td>
                                    <td width="15%" align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;PO Number:</td>
                                    <td width="48%" align="left">
                                        <html:text name="shippingAdviseForm" property="poNumber" size="20" maxlength="20" styleClass="txfield" disabled="true"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;No. Of Boxes:
                                        <logic:equal  name="shippingAdviseForm" property="dropShippment" value="true"><logic:equal name="shippingAdviseForm" property="status" value="ISSUED"><font color="red">*</font></logic:equal></logic:equal>
                                    </td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="cartonCount" size="20" maxlength="8" styleClass="txfield"/>
                                    </td>
                                    <td>&nbsp;</td>                                    
                                    <% if( ConfigManager.getShowPackageDimensionInPackingSlip() ) { %>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Net Weight:</td>
                                    <% } else { %>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Weight:</td>
                                    <% } %>
                                    <td align="left" >
                                        <html:text name="shippingAdviseForm" property="weight" size="20" maxlength="8" styleClass="txfield" onkeypress="javascript:restrictCharacters(this,5,2)" onkeyup="javascript:restrictAmt(this,5,2)" />
                                        &nbsp;
                                        <html:select name="shippingAdviseForm" property="weightType" styleClass="txfield">
                                            <html:options collection="weightMeasurementList" property="value" labelProperty="label" />
                                        </html:select>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Package Dimension:</td>
                                    <td align="left">
										<html:text name="shippingAdviseForm" property="packageDimension" size="20" maxlength="30" styleClass="txfield"/>
										&nbsp;
										<html:select name="shippingAdviseForm" property="uomPkgDimension" styleClass="txfield">
						                <html:options collection="uomPgkDimensionList" property="value" labelProperty="label" />
						                </html:select>
									</td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Gross Weight:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="grossWeight" size="20" maxlength="30" styleClass="txfield"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Forwarder:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="shippingMethod" size="20" maxlength="20" styleClass="txfield"/>
                                    </td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;<bean:message key="label.sales.salesOrder.DeliveryTerms" /> :</td>
                                    <td align="left"><html:text name="shippingAdviseForm" property="deliveryTerms" size="20" maxlength="20" styleClass="txfield"/></td>
                                </tr>
                                <tr> <%--to print status of Packing Slip--%>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Status:</td>
                                    <td align="left">
                                        <bean:write name="shippingAdviseForm" property="status"/>
                                    </td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Number of Pallets:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="paletteCount" size="20" maxlength="8" styleClass="txfield"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;<bean:message key="label.sales.shippingInstructions" /></td>
                                    <td align="left">
                                        <html:textarea rows="6"  name="shippingAdviseForm" property="shippingInstructions" cols="35" styleClass="txfield" onkeypress="javascript:checkLength(this, 300)" />
                                    </td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Comments:</td>
                                    <td align="left">
                                        <html:textarea rows="6" name="shippingAdviseForm" property="comments" cols="35" styleClass="txfield" onkeypress="javascript:checkLength(this, 300)" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">
                                        &nbsp;&nbsp;Ship Date:&nbsp;(mm/dd/yyyy)
                                        <logic:equal  name="shippingAdviseForm" property="dropShippment" value="true"><logic:equal name="shippingAdviseForm" property="status" value="ISSUED"><font color="red">*</font></logic:equal></logic:equal>
                                    </td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm"  property="shipDate" size="20" maxlength="10" styleClass="txfield"/>
                                        <a href="javascript:openCalendar( document.shippingAdviseForm.shipDate )">
                                            <img onMouseOver="window.status='Click  to select date';return true" onMouseout="window.status='';return 	true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20>
                                        </a>
                                    </td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Freight Instructions:</td>
                                    <td align="left">
                                        <html:textarea rows="6"  name="shippingAdviseForm" property="freightInstructions" cols="35" styleClass="txfield" onkeypress="javascript:checkLength(this, 300)" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Packed By:</td>
                                    <td align="left"><html:text name="shippingAdviseForm" property="packedby" size="20" maxlength="30" styleClass="txfield"/></td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Title:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="title" size="20" maxlength="30" styleClass="txfield"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;MAWB No:</td>
                                    <td align="left"><html:text name="shippingAdviseForm" property="mawb" size="20" maxlength="50" styleClass="txfield"/></td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;HAWB No:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="hawb" size="20" maxlength="50" styleClass="txfield"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Flight-1 No:</td>
                                    <td align="left"><html:text name="shippingAdviseForm" property="flightNumberOne" size="20" maxlength="50" styleClass="txfield"/></td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;Flight-2 No:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="flightNumberTwo" size="20" maxlength="50" styleClass="txfield"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;ETD:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="etd" size="20" maxlength="50" styleClass="txfield"/>
                                        <a href="javascript:openCalendar( document.shippingAdviseForm.etd )">
                                            <img onMouseOver="window.status='Click  to select date';return true" onMouseout="window.status='';return 	true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20>
                                        </a>
                                    </td>
                                    <td>&nbsp;</td>
                                    <td align="left" bgcolor="#DEE1E2">&nbsp;&nbsp;ETA:</td>
                                    <td align="left">
                                        <html:text name="shippingAdviseForm" property="eta" size="20" maxlength="50" styleClass="txfield"/>
                                        <a href="javascript:openCalendar( document.shippingAdviseForm.eta )">
                                            <img onMouseOver="window.status='Click  to select date';return true" onMouseout="window.status='';return 	true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20>
                                        </a>
                                    </td>
                                </tr>
                                <tr><td colspan=5><br></td></tr>
                                <tr>
                                    <td>
                                        <font class="NArialL">Way Bill:</font>
                                        <logic:equal  name="shippingAdviseForm" property="dropShippment" value="true"><logic:equal name="shippingAdviseForm" property="status" value="ISSUED"><font color="red">*</font></logic:equal></logic:equal>
                                    </td>
                                    <td colspan="4" align="left">
                                        <bean:size name="shippingAdviseForm" property="tracking" id="trackNoSize"/>
                                        <logic:greaterThan name="trackNoSize" value='0'>
                                            <logic:iterate name="shippingAdviseForm" property="tracking" id="track" indexId="trackIndx">
                                                <input type="text" name="tracking" size="20" maxlength="50" class="txfield" value='<bean:write name="track"/>'>
                                                <logic:greaterThan name="trackNoSize" value='<%=( trackIndx.intValue() + 1)+""%>'><br></logic:greaterThan>
                                            </logic:iterate>
                                        </logic:greaterThan>
                                        <logic:equal name="trackNoSize" value='0'>
                                                <input type="text" name="tracking" size="20" maxlength="50" class="txfield">
                                        </logic:equal>
                                        <a href="javascript:addTrackingNumberField('font1');" onMouseOver="window.status='Click to Add New Tracing Number';return true" onMouseOut="window.status='';return true"title='Click here to add new Trackig Number'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
                                    </td>
                                </tr>
                                <tr><td colspan="5"><font id="font1"></font></td></tr>
                                <tr>
                                    <td colspan="5">
                                    <br>
                                    <INPUT align=left border=0 maxLength=100 name="txtErrMsgDetail" size=100 style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: arial;font-size: 10pt;font-weight:bold " value="" readOnly>
                                    <FONT id="errors1" size="-2" color="FF0000"></FONT>
                                    </td>
                                </tr>
                                <%--==============================START-PS-LINE ITEMS=================================--%>
                                <logic:equal name="shippingAdviseForm" property="dropShippment" value="true">
                                <tr>
                                    <td colspan="5" width="100%" >
										<table border="0" width="100%" bordercolor="#FFFFFF">
											<tr>
									            <td width="4%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Select</font></font></td>
												<td width="4%" align="center" bgcolor="#993333">
													<font class="NArialL"><font color="#FFFFFF">Line Item</font></font>
												</td>
												<% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MFG_PARTNO_PACKINGSLIP ) ) { %>
												<td width="15%" align="center" bgcolor="#993333">
													<font class="NArialL"><font color="#FFFFFF"><bean:message key="label.mfgPartNumber"/></font></font>
												</td>
                                                <% }  %>
                                                <% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MRKT_PARTNO_PACKINGSLIP ) ) { %>
                                                <td width="15%" align="center" bgcolor="#993333">
													<font class="NArialL"><font color="#FFFFFF"><bean:message key="label.mktgPartNumber"/></font></font>
												</td>
                                                <% } %>
												<td width="30%" align="center" bgcolor="#993333" nowrap>
                                                    <font class="NArialL"><font color="#FFFFFF"><bean:message key="label.packingSlip.VendorFace.SubstitutePartNumber"/>&nbsp;&nbsp;</font></font>
												</td>
                                                <td width="25%" align="center" bgcolor="#993333" nowrap class="NArialL">
													<font color="#FFFFFF">&nbsp;Substituted&nbsp;</font>
												</td>
                                                <td align="center" bgcolor="#993333">
                                                    <font class="NArialL"><font color="#FFFFFF"><bean:message key="label.customerPartNumber"/></font></font>
                                                </td>
                                                <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Description</font></font></td>
                                                <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">UOM</font></font></td>
    											<td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Req. Dock Date</font></font></td>
												<td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Sch. Ship Date</font></font></td>
												<td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Requested Quantity</font></font></td>
												<td colspan="2" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Quantity Shipped</font></font></td>
                                                <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Quantity Remaining</font></font></td>
												<td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Status</font></font></td>
											</tr>
											<% int i = 0; %>
											<nested:iterate name="shippingAdviseForm" id="cslt" property="lineitems"  type="com.scalar.chiptrack.operations.packingslip.CustomerShippingLineItems" scope="request">
											<tr <%if( i++%2==0){%> bgcolor="#DEE1E2" <% } else {%> bgcolor="#FFFFFF" <%}%>>
                                                <td align="center" class="NArialL">
									                <input type="checkbox" checked="true"  disabled="true" name="selectLineitem" onclick="javascript:selectInventory(<%= ( i-1 )%>);"  class="NArialL"/>
                                                </td>
												<td align="center">
													<font class="NArialL"><nested:write property="lineitemNumber"/></font>
													<nested:hidden property="customerShippingLineItemId"/>
													<nested:hidden property="lineitemNumber"/>
													<nested:hidden property="lineItemId"/>
												</td>
                                                <nested:hidden property="part_Number"/>
												<nested:hidden property="parentPartNumber"/>
												<% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MFG_PARTNO_PACKINGSLIP ) ) { %>
												<td align="center" nowrap>
													<font class="NArialL"><nested:write property="part_Number"/></font>
												</td>
                                                <% }  %>
                                                <% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MRKT_PARTNO_PACKINGSLIP ) ) { %>
                                                <td align="center" nowrap>
													<font class="NArialL"><nested:write property="mkt_Part_Number"/></font>
												</td>
                                                <% }  %>
                                                <td align="center" class="NArialL" nowrap valign="center">
                                                    <nested:define id="subPartNoList" property="substitutablePartNumbers" type="java.util.ArrayList"/>
                                                    <nested:select property="shipped_Part_Number" multiple="true" styleClass="emptyList" disabled="true"  style="DISPLAY: none">
                                                        <html:options collection="subPartNoList" property="value" labelProperty="label" />
                                                    </nested:select>
                                                    <nested:write property="VSubstitutablePartNumbersAsTable" filter="false"/>
                                                </td>
                                                <td align="center" nowrap valign="center">
                                                    <nested:write property="VSubstitutablePartNumbersResultAsTable" filter="false"/>
                                                </td>
                                                <td align="center" nowrap>
                                                    <nested:text property="customer_Part_Number" disabled="true" size="15" maxlength="50" styleClass="txfield"/>
                                                </td>
                                                <td align="center">
                                                    <font class="NArialL">
                                                        <nested:textarea property="cool_Description" disabled="true" styleClass="txfield" rows="3" cols="20" onkeypress="javascript:checkLength(this, 200)" />
                                                    </font>
                                                </td>
                                                <td align="center" nowrap><nested:text property="units" disabled="true" size="8" maxlength="50" styleClass="txfield" /></td>
												<td align="right" nowrap><font class="NArialL"><nested:write property="cool_Requested_Date"/></font></td>
												<td align="right" nowrap><font class="NArialL">
												<nested:notEqual property="cool_Revised_Date" value="">
													<nested:write property="cool_Revised_Date"/>&nbsp;
												</nested:notEqual>
												<nested:equal property="cool_Revised_Date" value="">
													<nested:write property="cool_Schedule_Date"/>&nbsp;
												</nested:equal>
												</font></td>
												<td align="right" nowrap><font class="NArialL"><nested:write property="cool_Qty"/></font></td>
												<td align="right">
                                                    <nested:hidden property="cool_Qty"/>
                                                    <nested:hidden property="qtyToShip"/>
                                                    <% if ( request.getAttribute ("editback") != null ) { %>
                                                        <nested:hidden property="hiddenQtyPulled" />
                                                        <nested:hidden property="inventoryPulled" />
                                                    <% } else { %>
                                                        <nested:hidden property="hiddenQtyPulled" value='<%=cslt.getQtyPulled()+""%>'/>
                                                        <nested:hidden property="inventoryPulled" value='<%=cslt.getOrginalQtyPulled()+"" %>'/>
                                                    <% } %>
													<nested:hidden property="orginalQtyPulled"/>
                                                    <nested:text property="qtyPulled" size="8" disabled="true" maxlength="8" styleClass="txfield" />
												</td>
												<td align="right">
                                                    <nested:greaterThan property="qty_Available" value="0" >
                                                        <A href="javascript:openInventoryNew( <%=(i-1)%>, '<bean:write  name="shippingAdviseForm" property="viewInventory" />', '<bean:write  name="shippingAdviseForm" property="modifyInventory" />' );" onMouseOver="window.status='Click here to see the final finished goods and their locations';return true" onMouseOut="window.status='';return true">
                                                        <img border='0' alt="Click here to select inventory" height='12' width='16' src="<%=chipTracContext%>/jsp/includes/images/arrow.gif">
                                                        </A>
                                                    </nested:greaterThan>
                                                    <nested:lessEqual property="qty_Available" value="0" >
                                                        <img border='0' alt="No inventory found for <nested:write property="part_Number"/>" height='12' width='16' src="<%=chipTracContext%>/jsp/includes/images/cancel_icon.gif">
                                                    </nested:lessEqual>
												</td>
                                                <td align="center" >
													<font class="NArialL">
													    <font class="NArialL"><nested:write property="qtyToShip"/></font>
													</font>
												</td>
												<td align="center"><font class="NArialL"><bean:write name="shippingAdviseForm" property="status"/></font></td>
											</tr>
											</nested:iterate>
											<input type= "hidden" name = "count" value="<%=i%>">
										</table>
                                    </td>
                                </tr>
                                </logic:equal>
                                <logic:notEqual name="shippingAdviseForm" property="dropShippment" value="true">
                                <tr>
                                    <td colspan="5" width="100%" >
                                        <input type= "hidden" name = "count" value="0">&nbsp;
                                        <IMG height="1" src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="1200">
                                    </td>
                                </tr>
                                </logic:notEqual>
                                <%--=============================END-PS-LINE ITEMS=================================--%>
                                <tr><td colspan="5">&nbsp;</td></tr>
                                <tr>
                                    <td colspan=5 align=center>
                                        <chiptrack:restrictedLink href="javascript: updateinfo();" functionality="<%=Functionality.PACKING_SLIP%>" action="<%=User.USER_ACTION_MODIFY%>">
                                            <img border=0 src="<%=chipTracContext%>/jsp/includes/images/save.gif" border="0" onMouseOver="window.status='Click here to save the information';return true" onMouseOut="window.status='';return true">
                                        </chiptrack:restrictedLink>
                                        <%--<br>
                                        <font class="NArialS">[Click on the "save" to <font color=red><u>Update</u></font> and to <font color=red><u>Email</u></font> the shipment notification]</font>--%>
                                    </td>
                                </tr>
                                <logic:notEmpty name="shippingAdviseForm" property="showSendShipAlertLink">
                                <tr><td colspan=5 align=center><br>
                                    <font class='NArialL'>
                                        [<a href="javascript:sendShipAlert(<bean:write name="shippingAdviseForm" property="customerShippingId"/>, <bean:write name='shippingAdviseForm' property='salesOrderId'/>, 'ShipmentPickNotice' );" title='<bean:message key="label.packingSlip.VendorFace.AdminEmailLink"/>' onMouseOver="window.status='<bean:message key="label.packingSlip.VendorFace.AdminEmailLink"/>';return true" onMouseOut="window.status='';return true">
                                        <bean:message key="label.packingSlip.VendorFace.AdminEmailLink"/></a>]&nbsp;&nbsp;
                                        [<a href="javascript:sendShipAlert(<bean:write name="shippingAdviseForm" property="customerShippingId"/>, <bean:write name='shippingAdviseForm' property='salesOrderId'/>, 'PackingSlip' );" title='<bean:message key="label.packingSlip.VendorFace.ClientEmailLink"/>' onMouseOver="window.status='<bean:message key="label.packingSlip.VendorFace.ClientEmailLink"/>';return true" onMouseOut="window.status='';return true">
                                        <bean:message key="label.packingSlip.VendorFace.ClientEmailLink"/></a>]
                                    </font>
                                </td></tr>
                                </logic:notEmpty>
                                <%--<tr><td colspan=5 align=center><br><br>[ <a href='javascript:window.close();' onMouseOver="window.status='Click here to close window';return true" onMouseOut="window.status='';return true">Close this window</a> ]</td></tr>--%>
                                </table>
                            </html:form>
                        </td>
                    </tr>
                </table>
               <BR><BR><BR>
            </TD>
            <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
        </TR>
    </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
        <TR><TD bgColor='#493B76' colSpan=2><IMG height=2 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=800></TD></TR>
        <TR>
            <TD vAlign=top colSpan=2>
                <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                        <TR align=right>
                            <TD noWrap background=<%=chipTracContext%>/jsp/includes/images/blue_gradient_bg2.gif>
                                <SPAN class=copyright>&nbsp;&nbsp;Copyright 2002
                                <A class=copyright target=_new href="http://www.scalarsoft.com" onMouseOver="window.status='www.scalarsoft.com';return true" onMouseOut="window.status='';return true">
                                Scalarsoft Inc.</A>
                                </SPAN><BR>
                                <SPAN class=footer_element>&nbsp;&nbsp;<A class=footer_element href="mailto:info@scalarsoft.com" onMouseOver="window.status='Contact us : info@scalarsoft.com';return true" onMouseOut="window.status='';return true">
                                Contact Us</A>
                                </SPAN>
                            </TD>
                            <TD align=right bgColor='#80C455'></TD>
                        </TR>
                    </TBODY>
                </TABLE>
            </TD>
        </TR>
        <TR><TD bgColor='#493B76' colSpan=2><IMG height=2 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=800></TD></TR>
    </TBODY>
</TABLE>
</body>
</html:html>
